#include "head.h"
void *intput_W(){
	Wages *s = (Wages*)malloc(sizeof(Wages));
	printf("基本工资：");scanf("%d", &s->basic);
	printf("加班费：");scanf("%d", &s->overtime);
	printf("夜班费：");scanf("%d", &s->night);
	printf("房租：");scanf("%d", &s->rent);
	printf("事假扣款：");scanf("%d", &s->affair);
	printf("旷工扣款：");scanf("%d", &s->absenteeism);
	printf("其它扣款：");scanf("%d", &s->other);
	printf("现在的时间：\n"); 
	printf("现在的时间(年)：");scanf("%d", &s->nowyear);
	while(1){
		printf("现在的时间(月)：");scanf("%d", &s->nowmonth);
		if(s->nowmonth >= 1&&s->nowmonth <= 12){
			break;
		}
		else{
			printf("日期输入错误!!!\n");
		}
	}
	while(1){
		printf("现在的时间(日)：");scanf("%d", &s->nowday);
		if(s->nowmonth == 2){
			if(s->nowyear % 4 == 0&&s->nowyear % 100 != 0){
				if(s->nowday >= 1&&s->nowday <= 29){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}
			}
			else if(s->nowyear % 400 == 0){
				if(s->nowday >= 1&&s->nowday <= 29){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}
			}
			else{
				if(s->nowmonth >= 1&&s->nowmonth <= 28){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}	
			}
		}
		else if(s->nowmonth == 1||s->nowmonth == 3||s->nowmonth == 5||s->nowmonth == 7||s->nowmonth == 8||s->nowmonth == 10||s->nowmonth == 12){
			if(s->nowday >= 1&&s->nowday <= 31){
				break;
			}
			else{
				printf("日期输入错误!!!\n");
			}
		}
		else{
			if(s->nowday >= 1&&s->nowday <= 30){
				break;
			}
			else{
				printf("日期输入错误!!!\n");
			}
		}
	}
	return (void*)s;
}

void *intput_F(){
	Faculty *s = (Faculty*)malloc(sizeof(Faculty));
	fflush(stdin);
	printf("姓名：");scanf("%s", s->name);
	while(1){
		fflush(stdin);
		printf("性别：");s->gender = getchar();
		if(s->gender == 'F'||s->gender == 'S'){
			break;
		}
		else{
			printf("输入错误请输入S或F!!!\n");
		}
	}
	fflush(stdin);
	printf("出生日期：");scanf("%s", s->birth);
	printf("参加工作日期：\n");
	printf("参加工作日期(年)：");scanf("%d", &s->Participation_year);
	while(1){
		printf("参加工作日期(月)：");scanf("%d", &s->Participation_month);
		if(s->Participation_month >= 1&&s->Participation_month <= 12){
			break;
		}
		else{
			printf("日期输入错误!!!\n");
		}
	}
	while(1){
		printf("参加工作日期(日)：");scanf("%d", &s->Participation_day);
		if(s->Participation_month == 2){
			if(s->Participation_year % 4 == 0&&s->Participation_year % 100 != 0){
				if(s->Participation_day >= 1&&s->Participation_day <= 29){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}
			}
			else if(s->Participation_year % 400 == 0){
				if(s->Participation_day >= 1&&s->Participation_day <= 29){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}
			}
			else{
				if(s->Participation_month >= 1&&s->Participation_month <= 28){
					break;
				}
				else{
					printf("日期输入错误!!!\n");
				}	
			}
		}
		else if(s->Participation_month == 1||s->Participation_month == 3||s->Participation_month == 5||s->Participation_month == 7||s->Participation_month == 8||s->Participation_month == 10||s->Participation_month == 12){
			if(s->Participation_day >= 1&&s->Participation_day <= 31){
				break;
			}
			else{
				printf("日期输入错误!!!\n");
			}
		}
		else{
			if(s->Participation_day >= 1&&s->Participation_day <= 30){
				break;
			}
			else{
				printf("日期输入错误!!!\n");
			}
		}
	}
  	fflush(stdin);
	printf("所属部门：");scanf("%s", s->sector);
	printf("人员类别：");scanf("%s", s->category);
	fflush(stdin);
	printf("技术等级：");scanf("%d", &s->level);
	printf("技术职称：");scanf("%s", s->title);
	fflush(stdin);
	printf("文化程度：");scanf("%s", s->culturn);
	fflush(stdin);
	printf("民族：");scanf("%s", s->nation);
	fflush(stdin);
	printf("籍贯：");scanf("%s", s->native);
	fflush(stdin);
	printf("现住址：");scanf("%s", s->addressp);
	fflush(stdin);
	printf("岗位津贴：");scanf("%d", &s->allowance);
	printf("物价补贴：");scanf("%d", &s->subsidies);
	printf("岗位津贴：");scanf("%d", &s->allowance);
	printf("职务津贴：");scanf("%d", &s->duty);
	printf("住房补贴：");scanf("%d", &s->housing);
	printf("职工的出勤日数：");scanf("%d", &s->attenddanc_day);
	printf("公伤日数：");scanf("%d", &s->intjury);
	printf("产假日数：");scanf("%d", &s->maternbity_leave);
	printf("病假日数：");scanf("%d", &s->sick_day);
	printf("旷工日数：");scanf("%d", &s->absenteeism_day);
	printf("事假日数：");scanf("%d", &s->affair_day);
	printf("加班日数：");scanf("%d", &s->overtime_day);
	printf("夜班日数：");scanf("%d", &s->night_day);
	return (void*)s;
}